#include <iostream>
using namespace std;

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  long long k, d, t;

  cin >> k >> d >> t;
  t *= 2;

  long long interval, cost;

  if (k % d) {
    interval = k + d - k % d;
  } else {
    interval = k;
  }
  cost = interval + k;
  long long ans = (t / cost) * interval;

  t %= cost;
  if (t <= 2 * k) {
    cout << ans + t / 2;
    if (t % 2) {
      cout << ".5\n";
    } else {
      cout << ".0\n";
    }
  } else {
    ans += k;
    t -= 2 * k;
    cout << ans + t << "\n";
  }
  return 0;
}